Etasu endpoints#49
Conversation
|
this is working - what's left to do is to environmentalize variables with the docker configuration - env.json overrides everything that gets set via docker, need to figure out some workaround. Also fixing the limiting errors |
| src: '.' | ||
| sync_excludes: ['node_modules', 'logs'] | ||
|
|
||
| rems_dev_pharmacy-information-system-sync: |
There was a problem hiding this comment.
Should this be removed or is it kept around for a reason?
There was a problem hiding this comment.
should be removed, good catch
|
|
||
| // define schemas | ||
| const medicationCollection = await db.collection('medication-requirements' | ||
| // , { |
There was a problem hiding this comment.
Are these comments to show the structure?
If so maybe a comment stating that would be good. Otherwise it should be removed.
| await medicationCollection.createIndex({ name: 1 }, { unique: true }); | ||
|
|
||
| const metRequirementsCollection = await db.collection('met-requirements' | ||
| // , { |
There was a problem hiding this comment.
Are these comments to show the structure?
If so maybe a comment stating that would be good. Otherwise it should be removed.
|
|
||
|
|
||
| const remsCaseCollection = await db.collection('rems-case' | ||
| // , { |
There was a problem hiding this comment.
Are these comments to show the structure?
If so maybe a comment stating that would be good. Otherwise it should be removed.
| const patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; | ||
|
|
||
| const drug = await medicationCollection.findOne({ code: prescriptionCode, codeSystem: prescriptionSystem } | ||
| // , (err: any, result: any) => { |
There was a problem hiding this comment.
Cleanup these comments?
| } | ||
|
|
||
| configureEtasuEndpoints() { | ||
| const db = Globals.database; |
There was a problem hiding this comment.
Is there anyway we can split-up this huge method and move it into an ETASU specific file?
Describe your changes
This is dependent on changing to MonogDB, there are too many DB calls made for submitting requirements correctly and TingoDB requires you to handle DB calls via callbacks, which very quickly gets messy with multiple nested callbacks. Changing to MongoDB will allow us to use promises instead (supported by async await) which will make overall execution more straightforward and the code easier to read, so I am waiting on those changes since we are switching to MongoDB anyways.
Also the DB init and schema definitions need to be moved out to another file as to not create unnecessary clutter in the codebase.
Issue ticket number and Jira link
Please include the Jira Ticket Number and Link for this issue/task.
Checklist before requesting a review
devnot main (the only exception to this is releases fromdevand hotfix branches)Checklist for conducting a review
Workflow
Owner of the Pull Request will be responsible for merge after all requirements are met, including approval from at least one reviewer. Additional changes made after a review will dismiss any approvals and require re-review of the additional updates. Auto merging can be enabled below if additional changes are likely not to be needed. The bot will auto assign reviewers to your Pull Request for you.